package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wto.ClassRoom;
import com.wto.ClassRoomBean;
import com.wto.IUtilSql;
import com.wto.UtilSqlFactory;

/**
 * Servlet implementation class courseservlet
 */
@WebServlet("/CourseServlet")
public class CourseServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
   
 

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		response.setContentType("application/json;charset=utf-8");
		
//		String collegeId=(String) request.getAttribute("");
//		String s_Id=(String) request.getAttribute("");
//		String s_Name=(String) request.getAttribute("");
		
		PrintWriter out=response.getWriter();
		ClassRoomBean bean=new ClassRoomBean();
		bean.setCollegeID("0001");
		bean.setS_id("20161");
		bean.setS_name("");
		bean.setCampusID("1");
		bean.setTeachBuildID("1");
		bean.setClassRoomID("001");
		IUtilSql utilSql=new UtilSqlFactory().createUtilSql("classroom");
		ClassRoom teacher=(ClassRoom) utilSql.select(bean);
		out.println(teacher.toJsonObject());
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
		response.setContentType("text/html;charset=utf-8");
		
	}

}
